﻿using System;
using System.Collections;
using System.Collections.Generic;
using System.Text;
using Meqs.Entity;
using Meqs.Logic.Interface;

namespace Meqs.Logic.Implement
{
    public class ClassEvalCatchLogic : CommonLogic<ClassEvalCatch, int>, IClassEvalCatchLogic
    {
        #region Implementation of ICommonLogic<ClassEvalCatch, int>

        /// <summary>
        /// 创建对象
        /// </summary>
        /// <param name="entity"></param>
        /// <returns></returns>
        public int Create(ClassEvalCatch entity)
        {
            return CreateObject(entity);
        }

        /// <summary>
        /// 更新对象
        /// </summary>
        /// <param name="entity"></param>
        /// <returns></returns>
        public int Update(ClassEvalCatch entity)
        {
            return UpdateObject(entity);
        }

        /// <summary>
        /// 删除对象
        /// </summary>
        /// <param name="entityId"></param>
        /// <returns></returns>
        public int Delete(int entityId)
        {
            return DeleteObject(entityId);
        }

        /// <summary>
        /// 删除所有对象
        /// </summary>
        /// <returns></returns>
        public int DeleteAll()
        {
            return DeleteAllObject();
        }

        /// <summary>
        /// 
        /// </summary>
        /// <param name="entityId"></param>
        /// <returns></returns>
        public ClassEvalCatch FindById(int entityId)
        {
            return FindObjectById(entityId);
        }

        /// <summary>
        /// 检索对象数量
        /// </summary>
        /// <returns></returns>
        public int FindCount()
        {
            return FindObjectByCount();
        }

        /// <summary>
        /// 检索对象
        /// </summary>
        public IList<ClassEvalCatch> FindAll()
        {
            return FindAllObject();
        }

        /// <summary>
        /// 检索对象数量
        /// </summary>
        /// <returns></returns>
        public int FindCount(Hashtable table)
        {
            return FindObjectByCount(table);
        }

        /// <summary>
        /// 检索对象
        /// </summary>
        public IList<ClassEvalCatch> FindAll(Hashtable table)
        {
            return FindObject(table);
        }

        #endregion

        /// <summary>
        /// 插入记录
        /// </summary>
        public int InsertClassEvalCatch(ClassEvalCatch cpc, string schoolMark)
        {
            Hashtable ht = new Hashtable();
            ht.Add("ClassEvalCatch", cpc);
            ht.Add("SchoolMark", schoolMark);
            return (int)InsertCustomer("ClassEvalCatch.InsertClassEvalCatch", ht);
        }

        /// <summary>
        /// 删除缓存表中对应单据及学生的记录
        /// </summary>
        public int DeleteClassEvalCatch(int classID, int recordID, string schoolMark)
        {
            Hashtable ht = new Hashtable();
            ht.Add("ClassID", classID);
            ht.Add("RecordID", recordID);
            ht.Add("SchoolMark", schoolMark);
            return DeleteCustomer("ClassEvalCatch.DeleteClassEvalCatch", ht);
        }


        /// <summary>
        /// 获取评估分数
        /// </summary>
        /// <param name="th"></param>
        /// <returns></returns>
        public IList<UserProjectScore> FindKeyWordUserScore(Hashtable th)
        {
            try
            {
                string statementName = "ClassEvalCatch.FindKeyWordUserScore";
                return ExecuteQueryForList<UserProjectScore>(statementName, th);
            }
            catch (Exception ex)
            {
                throw;
            }
        }

        /// <summary>
        /// 类别信息
        /// </summary>
        /// <param name="th"></param>
        /// <returns></returns>

        public IList<ClassEvalType> FindKeyWordTypeInfo(Hashtable th)
        {
            try
            {
                string statementName = "ClassEvalCatch.FindKeyWordTypeInfo";
                return ExecuteQueryForList<ClassEvalType>(statementName, th);
            }
            catch (Exception ex)
            {
                throw;
            }
        }
        /// <summary>
        /// 题目信息
        /// </summary>
        /// <param name="th"></param>
        /// <returns></returns>
        public IList<ClassEvalItem> FindKeyWordItemInfo(Hashtable th)
        {
            try
            {
                string statementName = "ClassEvalCatch.FindKeyWordItemInfo";
                return ExecuteQueryForList<ClassEvalItem>(statementName, th);
            }
            catch (Exception ex)
            {
                throw;
            }
        }
        /// <summary>
        /// 获取月份评估信息
        /// </summary>
        /// <returns></returns>
        public IList<UserProjectScore> FindKeyWordMonthInfo(Hashtable ht)
        {
            try
            {
                string statementName = "ClassEvalCatch.FindKeyWordMonthInfo";
                return ExecuteQueryForList<UserProjectScore>(statementName, ht);
            }
            catch (Exception ex)
            {
                throw;
            }
        }

        public IList<YearAndMonth> FindKeyWordYearMonth(Hashtable ht)
        {
            try
            {
                string statementName = "ClassEvalCatch.FindKeyWordYearMonth";
                return ExecuteQueryForList<YearAndMonth>(statementName, ht);
            }
            catch (Exception ex)
            {
                throw;
            }
        }
        public IList<UserProjectScore> FindKeyWordMonthItemInfo(Hashtable ht)
        {
            try
            {
                string statementName = "ClassEvalCatch.FindKeyWordMonthItemInfo";
                return ExecuteQueryForList<UserProjectScore>(statementName, ht);
            }
            catch (Exception ex)
            {
                throw;
            }
        }
        public IList<UserProjectScore> FindKeyWordTermItemInfo(Hashtable ht)
        {
            try
            {
                string statementName = "ClassEvalCatch.FindKeyWordTermItemInfo";
                return ExecuteQueryForList<UserProjectScore>(statementName, ht);
            }
            catch (Exception ex)
            {
                throw;
            }
        }
        
    }
}
